/**
 * api接口管理， 全部以$开头 
 * @author terrfly
 * @site https://www.jeequan.com
 * @date 2021/12/17 09:57
 */


import http from '@/http/http.js'
import appConfig from '@/config/appConfig.js'

/** 获取获取用户ID的跳转URL */
export function $getRedirectUrl (data) {
  return http.req('/api/cashier/redirectUrl', data, 'POST')
}

/** 获取url **/
export function $getChannelUserId (data) {
  return http.req('/api/cashier/channelUserId', data, 'POST')
}

/** 调起支付接口, 获取支付数据包 **/
export function $getPayPackage (amount, buyerRemark, mbrId, mbrTel) {

  let data = { amount: amount, buyerRemark: buyerRemark, channelUserId: appConfig.channelUserId, mbrId, mbrTel }

  // 是否 子商户小程序 调起
  data.isUseSubmchAccount = appConfig.isUseSubmchAccount
  return http.req('/api/cashier/pay', data, 'POST')
}

/** 调起支付接口, 获取订单信息 **/
export function $getPayOrderInfo () {
  return http.req('/api/cashier/payOrderInfo', null, 'POST')
}

/** 取消支付时  语音播报提示 **/
export function $payCancelBoardCast (payOrderId) {
  let data = { payOrderId: payOrderId }
  return http.req('/api/cashier/payCancelBoardCast', data, 'POST')
}

/** 调起支付后，返回内容上报服务器 **/
export function $payEventBoardCast (payOrderId, resData) {
  let data = { payOrderId: payOrderId, resData: resData }
  return http.req('/api/cashier/payEventBoardCast', data, 'POST')
}

/** 支付成功后，获取广告 **/
export function $getAdvert (data=null) {
  return http.req('/api/advert', data, 'GET')
}
// 查询是否开启会员模块 此接口 会返回 会员接口的baseURL
export function $getIsMemberPower () {
  return http.req('/api/cashier/memberConfig', {}, 'GET')
}
